<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>添加API客户</title>
<script type="text/javascript">
	
/**
 * 选择省市区，触发变化，表单参数值传入隐藏域
 */
function areaOnChange(obj, str) {
	var $obj = $(obj);
	var text = $obj.find("option:selected").text();
	$("#" + str).val(text);
}

//图片上传的初始化
$('#uploadify').uploadify({
	'uploader' : 'uploadify/scripts/uploadify.swf',
	'script' : 'picUploadify', //指定服务端处理类的入口
	'folder' : 'upload/image',
	'cancelImg' : 'uploadify/cancel.png',
	'fileDataName' : 'uploadify', //和input的name属性值保持一致就好，Struts2就能处理了   
	'queueID' : 'fileQueue',
	'auto' : true,//是否选取文件后自动上传   
	'multi' : false,//是否支持多文件上传
	'simUploadLimit' : 1,//每次最大上传文件数   
	'fileDesc' : '.jpg文件或.gif文件或.png文件',//上传文件类型说明
	'fileExt' : '*.jpg;*.gif;*.png',
	'wmode' : 'transparent', //隐藏进度条
	'displayData' : 'percentage',//有speed和percentage两种，一个显示速度，一个显示完成百分比    
	'onComplete' : function(event, queueID, fileObj, response, data) {
		$("#picPath").val(response);
		$("#imgpath").html("<img src='"+response+"' />");
	}
});

//图片上传的初始化
$('#uploadify2').uploadify({
	'uploader' : 'uploadify/scripts/uploadify.swf',
	'script' : 'picUploadify', //指定服务端处理类的入口
	'folder' : 'upload/image',
	'cancelImg' : 'uploadify/cancel.png',
	'fileDataName' : 'uploadify', //和input的name属性值保持一致就好，Struts2就能处理了   
	'queueID' : 'fileQueue',
	'auto' : true,//是否选取文件后自动上传   
	'multi' : false,//是否支持多文件上传
	'simUploadLimit' : 1,//每次最大上传文件数   
	'fileDesc' : '.jpg文件或.gif文件或.png文件',//上传文件类型说明
	'fileExt' : '*.jpg;*.gif;*.png',
	'wmode' : 'transparent', //隐藏进度条
	'displayData' : 'percentage',//有speed和percentage两种，一个显示速度，一个显示完成百分比    
	'onComplete' : function(event, queueID, fileObj, response, data) {
		$("#picPath2").val(response);
		$("#imgpath2").html("<img src='"+response+"' />");
	}
});

//图片上传的初始化
$('#uploadify3').uploadify({
	'uploader' : 'uploadify/scripts/uploadify.swf',
	'script' : 'picUploadify', //指定服务端处理类的入口
	'folder' : 'upload/image',
	'cancelImg' : 'uploadify/cancel.png',
	'fileDataName' : 'uploadify', //和input的name属性值保持一致就好，Struts2就能处理了   
	'queueID' : 'fileQueue',
	'auto' : true,//是否选取文件后自动上传   
	'multi' : false,//是否支持多文件上传
	'simUploadLimit' : 1,//每次最大上传文件数   
	'fileDesc' : '.jpg文件或.gif文件或.png文件',//上传文件类型说明
	'fileExt' : '*.jpg;*.gif;*.png',
	'wmode' : 'transparent', //隐藏进度条
	'displayData' : 'percentage',//有speed和percentage两种，一个显示速度，一个显示完成百分比    
	'onComplete' : function(event, queueID, fileObj, response, data) {
		$("#picPath3").val(response);
		$("#imgpath3").html("<img src='"+response+"' />");
	}
});
	
</script>
</head>
<body>
	<div class="pageContent">
		<form class="pageForm required-validate" method="post" action="updateCompanyUserAction.action" onsubmit="return validateCallback(this, navTabAjaxDone);">
			<input type="hidden" name="rightId" value="${rightId}" /> <input name="id" value="<s:property value='#request.companyUser.id' />" type="hidden" />
			<div class="pageFormContent" layoutH="56">
				<table>

<tr>
						<td>公司代号：</td>
						<td><input name="companyCode" type="text" size="30" class="required textInput valid"  value="<s:property value='#request.companyUser.companyCode'/>"/></td>
					</tr>
					
					<tr>
						<td>省市区：</td>
						<td><select onChange="areaOnChange(this,'provinceName')" class="combox" name="provinceId" ref="combox_city" refUrl="getAreasNolimitAction.action?parentId={value}">
								<option value="<s:property value='#request.companyUser.proviceId'/>"><s:property value='#request.companyUser.provinceName' /></option>
								<c:forEach items="${areaList}" var="li">
									<option value="${li.id}">${li.name}</option>
								</c:forEach>
						</select> <select onChange="areaOnChange(this,'cityName')" class="combox" name="cityId" id="combox_city" ref="combox_area" refUrl="getAreasNolimitAction.action?parentId={value}">
								<option value="<s:property value='#request.companyUser.cityId'/>"><s:property value='#request.companyUser.cityName' /></option>
						</select> <select onChange="areaOnChange(this,'districtName')" class="combox" name="districtId" id="combox_area">
								<option value="<s:property value='#request.companyUser.districtId'/>"><s:property value='#request.companyUser.districtName' /></option>
						</select></td>
					</tr>
					<tr>
						<td>详细地址：</td>
						<td><input name="address" type="text" size="30" class="required textInput valid"  value="<s:property value='#request.companyUser.address'/>"/></td>
					</tr>
					
					<tr>
						<td>公司名称：</td>
						<td><input name="companyname" type="text" size="30" class="required textInput valid" value="<s:property value='#request.companyUser.companyName'/>"/></td>
					</tr>
					<tr>
						<td>公司电话：</td>
						<td><input name="companyTel" type="text" size="30" class="required textInput valid" value="<s:property value='#request.companyUser.companyTel'/>"/></td>
					</tr>
					<tr>
						<td>公司余额：</td>
						<td><input name="company_Balance" type="text" size="30" disabled="disabled" class="required textInput valid" value="<s:property value='#request.companyUser.company_Balance'/>"/></td>
					</tr>
					
					<tr>
					<td>支付确认码：</td>
						<td><input name="payPassword" type="text" size="30" class="required textInput valid" value="<s:property value='#request.companyUser.payPassword'/>" /></td>
					</tr>
					
					<tr>
						<td>联系人名称：</td>
						<td><input name="companyBoss" type="text" size="30" class="required textInput valid" value="<s:property value='#request.companyUser.companyBoss'/>"/></td>
					</tr>
					
					<tr>
						<td>联系人电话：</td>
						<td><input name="bossMobile" type="text" size="30" class="required textInput valid" value="<s:property value='#request.companyUser.bossMobile'/>"/></td>
					</tr>
					
					<tr>
						<td>联系人邮箱：</td>
						<td><input name="bossEmail" type="text" size="30" class="required textInput valid" value="<s:property value='#request.companyUser.bossEmail'/>"/></td>
					</tr>
					
										<tr>
						<td>图片1：</td>
						<td><input type="file" name="uploadify" id="uploadify" /> 
						<input id="picPath" type="hidden" name="photoUrl1"  value="<s:property value='#request.expressCompany.logUrl'/>" />
					</tr>
					<tr>
						<td colspan="2">
							<div id="imgpath">
								<img src="<s:property value='#request.companyUser.photoUrl1'/>">
							</div>
						</td>
					</tr>
					<tr>
						<td>图片2：</td>
						<td><input type="file" name="uploadify2" id="uploadify2" /> 
						<input id="picPath2" type="hidden" name="photoUrl2" value="<s:property value='#request.expressCompany.wxUrl'/>" />
					</tr>
					<tr>
						<td colspan="2">
							<div id="imgpath2">
								<img src="<s:property value='#request.companyUser.photoUrl2'/>">
							</div>
						</td>
					</tr>
					<tr>
						<td>图片3：</td>
						<td><input type="file" name="uploadify3" id="uploadify3" /> 
						<input id="picPath3" type="hidden" name="photoUrl3"  value="<s:property value='#request.expressCompany.applogoUrl'/>" />
					</tr>
					<tr>
						<td colspan="2">
							<div id="imgpath3">
								<img src="<s:property value='#request.companyUser.photoUrl3'/>">
							</div>
						</td>
					</tr>
	
					<tr>
						<td>是否可用：</td>
						<td>	
						<s:if test="#request.companyUser.locked==1">
							<select  name="locked" style="width: 120px">
								<option value="0">禁用</option>
								<option value="1" selected="selected">启用</option>							
							</select>
						</s:if>	
						<s:elseif test="#request.companyUser.locked==0">
							<select  name="locked" style="width: 120px">
								<option value="0" selected="selected">禁用</option>
								<option value="1">启用</option>							
							</select>
						</s:elseif>
					</td>
					</tr>


					
				</table>
				
				<!--传参 -->
				<div>
					<input id="provinceName" value="<s:property value='#request.companyUser.provinceName'/>" type="hidden" name="provinceName"> 
					<input id="cityName" value="<s:property value='#request.companyUser.cityName'/>" type="hidden" name="cityName"> 
					<input id="districtName" value="<s:property value='#request.companyUser.districtName'/>" type="hidden" name="districtName">
				</div>
			</div>
			<div class="formBar">
				<ul>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button type="submit">保存</button>
							</div>
						</div></li>
					<li>
						<div class="button">
							<div class="buttonContent">
								<button type="button" class="close">取消</button>
							</div>
						</div></li>
				</ul>
			</div>
		</form>
	</div>
</body>
</html>